#include<cstring>
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include <conio.h>
#include <windows.h>
#define M1 Beep(523,200);
#define M2 Beep(587,200);
#define M3 Beep(659,200);
#define M4 Beep(698,200);
#define M5 Beep(784,200);
#define M6 Beep(880,200);
#define M7 Beep(980,200);
#define qdo 262
#define qre 294
#define qmi 330   //q
#define qfa 349
#define qso 392
#define qla 440
#define qsi 494
#define do 523
#define re 578
#define mi 659
#define fa 698
#define so 784
#define la 880
#define si 988
#define do1 1046
#define re1 1175
#define mi1 1318
#define fa1 1480
#define so1 1568
#define la1 1760
#define si1 1976
#define sqdo 277
#define sqre 311
#define sqfa 370
#define sqso 415
#define sqla 466
#define sdo 554
#define sre 622
#define sfa 740
#define sso 831
#define sla 932
#define sdo1 1046
#define sre1 1245
#define sfa1 1480
#define sso1 1661
#define sla1 1865

using namespace std;


void play(char message[]){
    int timelen_m=500,timelen_s=200;
    for(int i=0;i<strlen(message);i++)
    switch(message[i]){
				// case '1':M1;break;
				// case '2':M2;break;
				// case '3':M3;break;
				// case '4':M4;break;
				// case '5':M5;break;
				// case '6':M6;break;
				// case '7':M7;break;
				case '1':Beep(sdo1,timelen_m);break;
				case '2':Beep(sre1,timelen_m);break;
				case '3':Beep(sfa1,timelen_m);break;
				case '4':Beep(sso1,timelen_m);break;
				case '5':Beep(sla1,timelen_m);break;
				case '6':Beep(sdo,timelen_m);break;
				case '7':Beep(sre,timelen_m);break;
				case '8':Beep(sfa,timelen_m);break;
				case '9':Beep(sso,timelen_m);break;
				case '0':Beep(sla,timelen_m);break;
				case 'q':Beep(do1,timelen_m);break;
				case 'w':Beep(re1,timelen_m);break;
				case 'e':Beep(mi1,timelen_m);break;
				case 'r':Beep(fa1,timelen_m);break;
				case 't':Beep(so1,timelen_m);break;
				case 'y':Beep(la1,timelen_m);break;
				case 'u':Beep(si1,timelen_m);break;
				case 'i':Beep(sqdo,timelen_m);break;
				case 'o':Beep(sqre,timelen_m);break;
				case 'a':Beep(do,timelen_m);break;
				case 's':Beep(re,timelen_m);break;
				case 'd':Beep(mi,timelen_m);break;
				case 'f':Beep(fa,timelen_m);break;
				case 'g':Beep(so,timelen_m);break;
				case 'h':Beep(la,timelen_m);break;
				case 'j':Beep(si,timelen_m);break;
				case 'k':Beep(sqfa,timelen_m);break;
				case 'l':Beep(sqso,timelen_m);break;
				case 'z':Beep(qdo,timelen_m);break;
				case 'x':Beep(qre,timelen_m);break;
				case 'c':Beep(qmi,timelen_m);break;
				case 'v':Beep(qfa,timelen_m);break;
				case 'b':Beep(qso,timelen_m);break;
				case 'n':Beep(qla,timelen_m);break;
				case 'm':Beep(qsi,timelen_m);break;
				case ',':Beep(sqso,timelen_m);break;
                case 'Q':Beep(do1,timelen_s);break;
				case 'W':Beep(re1,timelen_s);break;
				case 'E':Beep(mi1,timelen_s);break;
				case 'R':Beep(fa1,timelen_s);break;
				case 'T':Beep(so1,timelen_s);break;
				case 'Y':Beep(la1,timelen_s);break;
				case 'U':Beep(si1,timelen_s);break;
				case 'I':Beep(sqdo,timelen_s);break;
				case 'O':Beep(sqre,timelen_s);break;
				case 'A':Beep(do,timelen_s);break;
				case 'S':Beep(re,timelen_s);break;
				case 'D':Beep(mi,timelen_s);break;
				case 'F':Beep(fa,timelen_s);break;
				case 'G':Beep(so,timelen_s);break;
				case 'H':Beep(la,timelen_s);break;
				case 'J':Beep(si,timelen_s);break;
				case 'K':Beep(sqfa,timelen_s);break;
				case 'L':Beep(sqso,timelen_s);break;
				case 'Z':Beep(qdo,timelen_s);break;
				case 'X':Beep(qre,timelen_s);break;
				case 'C':Beep(qmi,timelen_s);break;
				case 'V':Beep(qfa,timelen_s);break;
				case 'B':Beep(qso,timelen_s);break;
				case 'N':Beep(qla,timelen_s);break;
				case 'M':Beep(qsi,timelen_s);break;
				case '.':Beep(sqso,timelen_s);break;
			}
}

void play_piano(){
	int i=0;std::string s;
    char ch;int timelen_m=333,timelen_s=222;
	while(1)
	{
		if(kbhit())
		{
			ch=getche();
			s+=ch;
            switch(ch)
			{
				// case '1':M1;break;
				// case '2':M2;break;
				// case '3':M3;break;
				// case '4':M4;break;
				// case '5':M5;break;
				// case '6':M6;break;
				// case '7':M7;break;
				case '1':Beep(sdo1,timelen_m);break;
				case '2':Beep(sre1,timelen_m);break;
				case '3':Beep(sfa1,timelen_m);break;
				case '4':Beep(sso1,timelen_m);break;
				case '5':Beep(sla1,timelen_m);break;
				case '6':Beep(sdo,timelen_m);break;
				case '7':Beep(sre,timelen_m);break;
				case '8':Beep(sfa,timelen_m);break;
				case '9':Beep(sso,timelen_m);break;
				case '0':Beep(sla,timelen_m);break;
				case 'q':Beep(do1,timelen_m);break;
				case 'w':Beep(re1,timelen_m);break;
				case 'e':Beep(mi1,timelen_m);break;
				case 'r':Beep(fa1,timelen_m);break;
				case 't':Beep(so1,timelen_m);break;
				case 'y':Beep(la1,timelen_m);break;
				case 'u':Beep(si1,timelen_m);break;
				case 'i':Beep(sqdo,timelen_m);break;
				case 'o':Beep(sqre,timelen_m);break;
				case 'a':Beep(do,timelen_m);break;
				case 's':Beep(re,timelen_m);break;
				case 'd':Beep(mi,timelen_m);break;
				case 'f':Beep(fa,timelen_m);break;
				case 'g':Beep(so,timelen_m);break;
				case 'h':Beep(la,timelen_m);break;
				case 'j':Beep(si,timelen_m);break;
				case 'k':Beep(sqfa,timelen_m);break;
				case 'l':Beep(sqso,timelen_m);break;
				case 'z':Beep(qdo,timelen_m);break;
				case 'x':Beep(qre,timelen_m);break;
				case 'c':Beep(qmi,timelen_m);break;
				case 'v':Beep(qfa,timelen_m);break;
				case 'b':Beep(qso,timelen_m);break;
				case 'n':Beep(qla,timelen_m);break;
				case 'm':Beep(qsi,timelen_m);break;
				case ',':Beep(sqso,timelen_m);break;
                case 'Q':Beep(do1,timelen_s);break;
				case 'W':Beep(re1,timelen_s);break;
				case 'E':Beep(mi1,timelen_s);break;
				case 'R':Beep(fa1,timelen_s);break;
				case 'T':Beep(so1,timelen_s);break;
				case 'Y':Beep(la1,timelen_s);break;
				case 'U':Beep(si1,timelen_s);break;
				case 'I':Beep(sqdo,timelen_s);break;
				case 'O':Beep(sqre,timelen_s);break;
				case 'A':Beep(do,timelen_s);break;
				case 'S':Beep(re,timelen_s);break;
				case 'D':Beep(mi,timelen_s);break;
				case 'F':Beep(fa,timelen_s);break;
				case 'G':Beep(so,timelen_s);break;
				case 'H':Beep(la,timelen_s);break;
				case 'J':Beep(si,timelen_s);break;
				case 'K':Beep(sqfa,timelen_s);break;
				case 'L':Beep(sqso,timelen_s);break;
				case 'Z':Beep(qdo,timelen_s);break;
				case 'X':Beep(qre,timelen_s);break;
				case 'C':Beep(qmi,timelen_s);break;
				case 'V':Beep(qfa,timelen_s);break;
				case 'B':Beep(qso,timelen_s);break;
				case 'N':Beep(qla,timelen_s);break;
				case 'M':Beep(qsi,timelen_s);break;
				case '.':Beep(sqso,timelen_s);break;
			}
			if(s.find("continue")!=std::string::npos){
                    s.erase(0,s.length());
				    printf("\n    /\\         /\\ \n");
					printf("   |   \\     /    \\\n");
					printf("  / .  |    /  .  |\n");
					printf(" |  .. \\    |  ..  |\n");
					printf("/  ....  |  |  ... /\n");
					printf("| -///**\\\\\\\\\\\\\\**-- |\n");
					printf("/// -- -_     _- --  \\\\\n");
					printf("|/\\\\__fu_|   |_tao_/   |\n");
					printf("\\\\/      __-__        /  - -Yan xu continuuuuuuuuuuuuuuuuuue\n");
    				printf(" \\       \\__/       /| ");
					printf("==========================\n");
			}
            if(s.find("exit")!=std::string::npos){
                cout<<endl;
                return;
            }
            if(s.find("retrq")!=std::string::npos){
                s.erase(0,s.length());
                Sleep(1000);//retrqwretrqwrerewqretwu
                char message[]="retrqwretrqwrerewqretwu";
                play(message);
            }
		}
	}
}

int main(){
    play_piano();
    return 0;
}